const { find } = require('../dao/filmsDao');
const filmsService = require('../service/filmsService')

require('../db.js');
async function testFind() {
    let data=await filmsService.find({}, { current: 1, size: 3 });
    // console.log(await filmsService.find({}, { current: 1, size: 3 }));
    console.log(data.rows[0].images[0]);
}
// testFind()

async function testInsert() {
    console.log(await filmsService.insert({
        name: '小时代',
        ename: 'rzdyuifgs',
        type: ' fdsfgs',
        area: '中国大陆',
        poster: 'adfgerd',
        upDate: '4月21号',
        year: '90年代',
        score: 5,
        count: '3456万',
        want: '65765人',
        intro: 'frrtr45345thystj',
        status: 2,
        director: ['wefg', 'faeg'],
        actor: ['fgs'],
        images: ['sg']
    }));
}

testInsert();

async function testDelete(id){
    console.log(await filmsService.delete(id));
}
// testDelete('607f9ab0e33c4565d82dcd72')

async function testUpdate(id,filmObj){
    let data=await filmsService.find({name:'让子弹飞'},{ current: 1, size: 3 })
    // console.log(data.rows);
    data.rows[0].type='文艺';
    console.log(await filmsService.update('607f986cce466743d06b2aa5',data.rows[0]));
}
// testUpdate();